//===============================================================================
// Microsoft patterns & practices
// Guidance Explorer Offline Client
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================

using GuidanceExplorer.Controls;

namespace GuidanceExplorer.Model
{
    class IsFileSubscribedLibraryCondition : IMenuItemCondition
    {
        #region IMenuItemCondition Members

        public bool ShowMenuItem(MenuItemAttribute attribute, IModelItem modelItem)
        {
            if (modelItem == null)
            {
                return false;
            }
            else
            {
                //If there is a library.
                LibraryNode libraryNode = modelItem as LibraryNode;
                if (libraryNode != null)
                {
                    return libraryNode.ModelInstance.FileSubscribed;
                }

                return false;
            }
        }

        #endregion
    }
}
